using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Text;
using System.Data; 
using yq.IBase; 
using yq.Dictionary; 
using yq.Basis; 
using yq.Model.Logic;
using System.Collections; 
using Db; 
using System.Data.Common;

namespace yq.Model.Base 
{
    ///<summary>
    /// Vod_Album - 视频专辑名称 - 对象基础类
    /// </summary>
    ///<typeparam name="T"></typeparam>
    public abstract class IVodAlbum<T> :ModelBase<VodAlbum> where T : VodAlbum, new()
    {
        /// <summary>
        /// 写入主键值
        /// </summary>
        /// <param name="Id">主键</param>
        protected internal override void SetKeyValue(dynamic Id)
        {
            this.VodId = Id;
        }

        /// <summary>
        /// 获取主键值
        /// </summary>
        /// <returns></returns>
        protected internal override dynamic GetKeyValue()
        {
            return VodId;
        }

        /// <summary>
        /// 为本对象赋值
        /// </summary>
        /// <param name="dy"></param>
        public override void SetValue(dynamic dy) 
        {
           this.VodId=dy.VodId;
           this.Title=dy.Title;
           this.ImgId=dy.ImgId;
           this.CreationTime=dy.CreationTime;
           this.Explain=dy.Explain;
           this.VodCount=dy.VodCount;
           this.Sno=dy.Sno;
           this.Version=dy.Version;
        } 

        #region 定义属性

     
         /// <summary>
        /// 目录ID
        /// </summary>
        private String _VodId = "";
      
        /// <summary>
        /// 目录ID
        /// </summary>
        public String VodId
        {
            get 
            {
              return   (this._VodId); 
            }

            set 
            {
                    _VodId= value;  
            }
        }
       
     
         /// <summary>
        /// 标题
        /// </summary>
        private String _Title = "";
      
        /// <summary>
        /// 标题
        /// </summary>
        public String Title
        {
            get 
            {
              return   (this._Title); 
            }

            set 
            {
                    _Title= value;  
            }
        }
       
     
         /// <summary>
        /// 封面图片
        /// </summary>
        private String _ImgId = "";
      
        /// <summary>
        /// 封面图片
        /// </summary>
        public String ImgId
        {
            get 
            {
              return   (this._ImgId); 
            }

            set 
            {
                    _ImgId= value;  
            }
        }
       
     
         /// <summary>
        /// 创建时间
        /// </summary>
        private DateTime _CreationTime =DateTime.MinValue;
      
        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime CreationTime
        {
            get 
            {
              return   (this._CreationTime); 
            }

            set 
            {
                    _CreationTime= value;  
            }
        }
       
     
         /// <summary>
        /// 说明
        /// </summary>
        private String _Explain = "";
      
        /// <summary>
        /// 说明
        /// </summary>
        public String Explain
        {
            get 
            {
              return   (this._Explain); 
            }

            set 
            {
                    _Explain= value;  
            }
        }
       
     
         /// <summary>
        /// 已有视频数量
        /// </summary>
        private int _VodCount =int.MinValue;
      
        /// <summary>
        /// 已有视频数量
        /// </summary>
        public int VodCount
        {
            get 
            {
              return   (this._VodCount); 
            }

            set 
            {
                    _VodCount= value;  
            }
        }
       
     
         /// <summary>
        /// 排序
        /// </summary>
        private int _Sno =int.MinValue;
      
        /// <summary>
        /// 排序
        /// </summary>
        public int Sno
        {
            get 
            {
              return   (this._Sno); 
            }

            set 
            {
                    _Sno= value;  
            }
        }
       

      #endregion 定义属性 

          protected internal override void SetValue(VodAlbum info, DataRow row) 
          { 
               if (row == null) 
               { 
                 info.IsLoad = false; 
               }
               else 
               { 
                  info.IsLoad = true; 
                  
                  if(row["VodId"]!= DBNull.Value)
                  {
                  info.VodId=row["VodId"].ToString();
                 }
                 
                  
                  if(row["Title"]!= DBNull.Value)
                  {
                  info.Title=row["Title"].ToString();
                 }
                 
                  
                  if(row["ImgId"]!= DBNull.Value)
                  {
                  info.ImgId=row["ImgId"].ToString();
                 }
                 
                  
                  if(row["CreationTime"]!= DBNull.Value)
                  {
                  info.CreationTime=Convert.ToDateTime(row["CreationTime"]);
                 }
                 
                  
                  if(row["Explain"]!= DBNull.Value)
                  {
                  info.Explain=row["Explain"].ToString();
                 }
                 
                  
                  if(row["VodCount"]!= DBNull.Value)
                  {
                  info.VodCount=Convert.ToInt32(row["VodCount"]);
                 }
                 
                  
                  if(row["Sno"]!= DBNull.Value)
                  {
                  info.Sno=Convert.ToInt32(row["Sno"]);
                 }
                 
                  
                  if(row["Version"]!= DBNull.Value)
                  {
                  info.Version=row["Version"].ToString();
                 }
                 
               } 

          } 

        protected internal override void GetDbParameters(DbCommand comm, VodAlbum info, DbHelper cn) 
        { 
             
                cn.AddInParameter(comm, "@VodId", DbType.String,ParameterTool.GetObj( info._VodId )); 
            
             
                cn.AddInParameter(comm, "@Title", DbType.String,ParameterTool.GetObj( info._Title )); 
            
             
                cn.AddInParameter(comm, "@ImgId", DbType.String,ParameterTool.GetObj( info._ImgId )); 
            
             
                cn.AddInParameter(comm, "@CreationTime", DbType.DateTime,ParameterTool.GetObj( info._CreationTime )); 
            
             
                cn.AddInParameter(comm, "@Explain", DbType.String,ParameterTool.GetObj( info._Explain )); 
            
             
                cn.AddInParameter(comm, "@VodCount", DbType.Int32,ParameterTool.GetObj( info._VodCount )); 
            
             
                cn.AddInParameter(comm, "@Sno", DbType.Int32,ParameterTool.GetObj( info._Sno )); 
            
                
                cn.AddInParameter(comm,"@Version", DbType.String, Guid.NewGuid().ToString());
              

                cn.AddInParameter(comm,"@_versionOdl", DbType.String, info._Version); 
                 
        } 

    } 
} 